package com.yungu.swift.admin.route.operation;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yungu.swift.admin.consts.AdminErrorEnum;
import com.yungu.swift.base.ResponseData;
import com.yungu.swift.base.model.PageVo;
import com.yungu.swift.constants.CommonConstant;
import com.yungu.swift.order.model.vo.JsonOrderListVo;
import com.yungu.swift.order.service.OrderAdminService;
import com.yungu.swift.system.sys.model.param.AdminAssetsPageAdmin;
import com.yungu.swift.utils.MapUtils;
import com.yungu.swift.utils.ParamUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author : cuixiuyin
 * @date : 2019/6/21
 */
@RestController
@RequestMapping("/admin/v1/operation/assets")
@Api(value = "【运营管理】", tags = "资产公共接口")
public class AssetsAdmin {

    @Reference
    private OrderAdminService orderAdminService;

    @RequestMapping(value = "/orderList", method = RequestMethod.POST)
    @ApiOperation(value = "资产关联订单列表", httpMethod = "POST")
    public ResponseData<PageVo<JsonOrderListVo>> orderList(@RequestBody AdminAssetsPageAdmin orderPageAdmin) {
        if (ParamUtil.isIllegal(orderPageAdmin.getUuid(), orderPageAdmin.getType())) {
            return ResponseData.buildErrorResponse(AdminErrorEnum.PARAM_ERROR.getCode(), AdminErrorEnum.PARAM_ERROR.getMsg());
        }
        return orderAdminService.orderQueryPage(orderPageAdmin);
    }
}
